<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
</head>
<body>
    登录：
    <input type="text" id="snInput">
    密码：
    <input type="password" id="pswdInput">
    <button onclick="login()">确认登录</button>
    
</body>
<script>
    function login(){
        var requestOptions = {
   method: 'GET',
   redirect: 'follow'
};
const sn = document.getElementById("snInput").value;
const pswd = document.getElementById("pswdInput").value;


fetch("https://study.godoai.com/api/user/login/"+sn+"/"+pswd, requestOptions)
   .then(response => response.json())
   .then(result => {
    console.log(result)
    if(result.Code == 1000){
        alert("登陆成功")
        window.location.href = "./userlist.html"
    }else{
        alert("登陆失败")
    }
   })
   .catch(error => console.log('error', error));
    }
</script>
</html>